package com.qww.exec02;

public class SubClass extends Detergent {

    public SubClass scrub() {
        append(" SubClass.scrub()");
        return this;
    }

    public SubClass sterilize() {
        append(" sterilize()");
        return this;
    }

    public static void main(String[] args) {
        SubClass x = new SubClass();
        x.scrub().sterilize().foam();
        System.out.println(x);
        System.out.println("Testing Detergent base class: ");
        Detergent.main(args);
    }
}

/* 运行结果
Cleanser SubClass.scrub() sterilize() foam()
Testing Detergent base class:
Cleanser foam() dilute() apply() Detergent.scrub() scrub()
Testing base class:
Cleanser dilute() apply() scrub()
 */